Skip to content

Add auto-barter to trade UI and global toggle to trade agreements#1577

Open
sizzlins wants to merge 6 commits intoDFHack:masterfrom
sizzlins:feature/auto-barter-and-trade-agreement-toggle
Open

Add auto-barter to trade UI and global toggle to trade agreements#1577
sizzlins wants to merge 6 commits intoDFHack:masterfrom
sizzlins:feature/auto-barter-and-trade-agreement-toggle

Conversation

@sizzlins
Copy link
Copy Markdown

  • Adds an 'Auto Barter' feature to the trade window, calculating required values and automatically selecting merchant/fortress goods to match an internal margin factor.
  • Adds a global 'Select Globally' toggle hotkey to the diplomacy requests UI to select/deselect requests from all available tabs.

@sizzlins sizzlins marked this pull request as ready for review April 21, 2026 12:05
@sizzlins
Copy link
Copy Markdown
Author

sizzlins commented Apr 21, 2026

Auto Barter, automatically selects depot goods to match chosen merchants good with a * 1.25 profit margin for the merchant. Expensive means selecting the most valuable item first to trade with. Cheap means choosing the cheapest items first to trade with.
Screenshot 2026-04-21 114046

@sizzlins
Copy link
Copy Markdown
Author

Select Globally, selects all item requests for next years caravan diplomacy.
Screenshot 2026-04-21 102002

@eTzmNcbkrng
Copy link
Copy Markdown

The wiki says you should do this with a macro but doesn't provide an example, I tried searching for one but couldn't find.
This is awesome! I'm going to test it now

FWIW, I tried AI vibe-coding an edit to tradeagreement.lua to give the option to "select by weight". I was trying to get the lightest and heaviest boulders available. I was ultimately unsuccessful but maybe that's something you'd find useful.

@sizzlins
Copy link
Copy Markdown
Author

The wiki says you should do this with a macro but doesn't provide an example, I tried searching for one but couldn't find. This is awesome! I'm going to test it now

FWIW, I tried AI vibe-coding an edit to tradeagreement.lua to give the option to "select by weight". I was trying to get the lightest and heaviest boulders available. I was ultimately unsuccessful but maybe that's something you'd find useful.

the script has a builtin cheat sheet that tells it exactly where to find lists of things like leather, meat, and gems in the game's data, however, it doesn't have a cheat sheet for finding stones and boulders, because it doesn't know how to look up the list of available stones, the script simply hides the select by value button whenever you click on the stone tab.

i am currently working to add this feature, select by weight

…o trade agreements

- Implements persistent, per-civ trade agreement saving/loading
- Adds 'Select by Weight' and 'Select by Value' sorting for Boulders, Metal, Cheese, Crafts, Mugs, Glass, Silk, and almost all other raw materials.
- Includes numerous defensive nil-checks for safe memory parsing.
@sizzlins
Copy link
Copy Markdown
Author

image

@sizzlins sizzlins force-pushed the feature/auto-barter-and-trade-agreement-toggle branch from 7e740b6 to 1529058 Compare April 23, 2026 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants